"""Added shop_address to Shop and delivery_method to Order

Revision ID: af8f63862066
Revises: c22d39ffb631
Create Date: 2024-01-17 13:06:13.278835

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "af8f63862066"
down_revision = "c22d39ffb631"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.execute("CREATE TYPE deliverymethod AS ENUM ('courier', 'self_pickup')")
    op.add_column(
        "order",
        sa.Column(
            "delivery_method",
            sa.Enum("courier", "self_pickup", name="deliverymethod"),
            server_default="courier",
            nullable=False,
        ),
    )
    op.add_column("shop", sa.Column("contact_address", sa.TEXT(), nullable=True))
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("shop", "contact_address")
    op.drop_column("order", "delivery_method")
    op.execute("DROP TYPE IF EXISTS deliverymethod")
    # ### end Alembic commands ###
